import request from '@/utils/request'

// 获取分类
export function getCategories(params) {
  return request({
    url: '/categories',
    method: 'get',
    params
  })
}

// 编辑分类
export function editCategories(id, data) {
  return request({
    url: `/categories/${id}`,
    method: 'put',
    data

  })
}

// 删除分类
export function delCategories(id) {
  return request({
    url: `/categories/${id}`,
    method: 'delete'
  })
}

// 新建分类
export function addCategories(data) {
  return request({
    url: `/categories`,
    method: 'post',
    data
  })
}

// 回显
export function DetailById(id) {
  return request({
    url: `/categories/${id}`,
    method: 'GET'
  })
}

// 分页
export function CategoryCount(params) {
  return request({
    url: `/categories/count`,
    method: 'GET',
    params
  })
}
